package com.ruoyi.web.controller.system;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.Sendcheckcompanydictionary;
import com.ruoyi.system.service.ISendcheckcompanydictionaryService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 【单位字典】Controller
 * 
 * @author ruoyi
 * @date 2024-07-01
 */
@RestController
@RequestMapping("/system/sendcheckcompanydictionary")
public class SendcheckcompanydictionaryController extends BaseController
{
    @Autowired
    private ISendcheckcompanydictionaryService sendcheckcompanydictionaryService;

    /**
     * 查询【单位字典】列表
     */
    @PreAuthorize("@ss.hasPermi('system:sendcheckcompanydictionary:list')")
    @GetMapping("/list")
    public TableDataInfo list(Sendcheckcompanydictionary sendcheckcompanydictionary)
    {
        startPage();
        List<Sendcheckcompanydictionary> list = sendcheckcompanydictionaryService.selectSendcheckcompanydictionaryList(sendcheckcompanydictionary);
        return getDataTable(list);
    }

    /**
     * 导出【单位字典】列表
     */
    @PreAuthorize("@ss.hasPermi('system:sendcheckcompanydictionary:export')")
    @Log(title = "【单位字典】", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Sendcheckcompanydictionary sendcheckcompanydictionary)
    {
        List<Sendcheckcompanydictionary> list = sendcheckcompanydictionaryService.selectSendcheckcompanydictionaryList(sendcheckcompanydictionary);
        ExcelUtil<Sendcheckcompanydictionary> util = new ExcelUtil<Sendcheckcompanydictionary>(Sendcheckcompanydictionary.class);
        util.exportExcel(response, list, "【单位字典】数据");
    }

    /**
     * 获取【单位字典】详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:sendcheckcompanydictionary:query')")
    @GetMapping(value = "/{CompanyName}")
    public AjaxResult getInfo(@PathVariable("CompanyName") String CompanyName)
    {
        return success(sendcheckcompanydictionaryService.selectSendcheckcompanydictionaryByCompanyName(CompanyName));
    }

    /**
     * 新增【单位字典】
     */
    @PreAuthorize("@ss.hasPermi('system:sendcheckcompanydictionary:add')")
    @Log(title = "【单位字典】", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Sendcheckcompanydictionary sendcheckcompanydictionary)
    {
        return toAjax(sendcheckcompanydictionaryService.insertSendcheckcompanydictionary(sendcheckcompanydictionary));
    }

    /**
     * 修改【单位字典】
     */
    @PreAuthorize("@ss.hasPermi('system:sendcheckcompanydictionary:edit')")
    @Log(title = "【单位字典】", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Sendcheckcompanydictionary sendcheckcompanydictionary)
    {
        return toAjax(sendcheckcompanydictionaryService.updateSendcheckcompanydictionary(sendcheckcompanydictionary));
    }

    /**
     * 删除【单位字典】
     */
    @PreAuthorize("@ss.hasPermi('system:sendcheckcompanydictionary:remove')")
    @Log(title = "【单位字典】", businessType = BusinessType.DELETE)
	@DeleteMapping("/{CompanyNames}")
    public AjaxResult remove(@PathVariable String[] CompanyNames)
    {
        return toAjax(sendcheckcompanydictionaryService.deleteSendcheckcompanydictionaryByCompanyNames(CompanyNames));
    }
}
